import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

const store = new Vuex.Store({
	state: {
		hasLogin: false,
		accessToken: '',
		gotoinfo: {
			pageurl: '/pages/index/index',
			pagetype: "reLaunch",
			
		}, //需要跳转的页面 //跳转的类型
	},
	mutations: {
		login(state, accessToken) {
			state.hasLogin = true;
			state.accessToken=accessToken;
		},
		logout(state) {
			state.hasLogin = false
			state.accessToken = null
		},
		setGotoInfo(state,url="/pages/index/index",type="reLaunch"){
			state.gotoinfo.pageurl=url;
			state.gotoinfo.pagetype=type;
		}
	},
})


export default store
